package com.ruoyi.user.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.utils.AliyunOssUtil;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.api.model.IdVo;
import com.ruoyi.system.api.model.LoginInfoVo;
import com.ruoyi.system.api.model.PageInfoVo;
import com.ruoyi.system.api.model.TbUserVo;
import com.ruoyi.user.service.TbUserService;
import com.ruoyi.user.utils.HttpUtils;
import com.ruoyi.user.utils.IdCardORCUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * @description: TbUserController
 * @Author 王辉
 * @Version 1.0
 * @date 2023/1/12 19:41
 */
@Api(tags = "User")
@RestController
@Slf4j
@RequestMapping("/user")
public class TbUserController {

    @Resource
    private TbUserService tbUserService;

    @ApiOperation("注册功能")
    @PostMapping("/register")
    public AjaxResult register(@RequestBody TbUserVo tbUserVo) {
        return tbUserService.register(tbUserVo);
    }

    @ApiOperation("登录功能")
    @PostMapping("/login")
    public AjaxResult register(@RequestBody LoginInfoVo loginInfoVo) {
        return tbUserService.login(loginInfoVo);
    }

    @ApiOperation("删除功能")
    @PostMapping("/del")
    public AjaxResult del(@RequestBody IdVo idVo) {
        return tbUserService.del(idVo);
    }


    @ApiOperation("用户-列表")
    @PostMapping("/list")
    public AjaxResult list(@RequestBody PageInfoVo pageInfoVo) {
        return tbUserService.listByPage(pageInfoVo);
    }

    @ApiOperation("修改功能")
    @PostMapping("/set")
    public AjaxResult set(@RequestBody TbUserVo tbUserVo) {

        return tbUserService.set(tbUserVo);
    }
    @ApiOperation("修改setCode功能")
    @PostMapping("/setCode")
    public AjaxResult setCode(@RequestBody TbUserVo tbUserVo) {

       return tbUserService.setCode(tbUserVo);
    }



}
